package cn.wolfcode.wolf2w.controller;

import cn.wolfcode.wolf2w.domain.Strategy;
import cn.wolfcode.wolf2w.domain.StrategyCatalog;
import cn.wolfcode.wolf2w.domain.Travel;
import cn.wolfcode.wolf2w.service.*;
import cn.wolfcode.wolf2w.service.impl.StrategyServiceImpl;
import cn.wolfcode.wolf2w.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("destinations")
public class DestinationController {
    @Autowired
    private IDestinationService destinationService;
    @Autowired
    private IStrategyCatalogService strategyCatalogService;
    @Autowired
    private IStrategyService strategyService;
    @Autowired
    private ITravelService travelService;
    @Autowired
    private IRegionService regionService;
    //热门区域
    @GetMapping("/hotRegion")
    public Object hotRegion() {
        return JsonResult.success(regionService.queryHotRegion());
    }
    //区域id查目的地以及城市
    @GetMapping("/search")
    public Object search(String regionId) {
        return JsonResult.success(destinationService.queryDestByRegionIdForApi(regionId));
    }

    //吐司
    @GetMapping("/toasts")
    public Object toasts(String destId) {
        return JsonResult.success(destinationService.queryToasts(destId));
    }

    //概况里的主题和攻略的简单标题
    @GetMapping("/catalogs")
    public Object detail(String destId) {
        List<StrategyCatalog> list = strategyCatalogService.queryCatalogByDestId(destId);
        return JsonResult.success(list);
    }

    //攻略查前三
    @GetMapping("/strategies/viewnumTop3")
    public Object viewnumTop3(String destId) {
        List<Strategy> list = strategyService.queryViewnumTop3(destId);
        return JsonResult.success(list);
    }
    //游记查前三
    @GetMapping("/travels/viewnumTop3")
    public Object travelsViewnumTop3(String destId) {
        List<Travel> list = travelService.travelsViewnumTop3(destId);
        return JsonResult.success(list);
    }


}
